# 循环的两个要素：条件，操作
# 循环只要满足条件就执行操作

"""
i = 0
while i < 100:
    print("%d " % i)
    i += 1
"""

import random

num = random.randint(1, 100)
count = 0
flag = True
while flag:
    guess_num = int(input("输入猜测数字："))
    count += 1
    if guess_num == num:
        print("猜中了")
        flag = False
    else:
        if guess_num > num:
            print("猜大了")
        else:
            print("猜小了")
print(f"你总共猜了{count}次")
